package com.haochang.chunkvod.controller.adapter.hostess;

import java.util.List;

import com.haochang.base.OnBaseClickListener;
import com.haochang.chunkvod.R;
import com.haochang.chunkvod.app.utils.CollectionUtils;
import com.haochang.chunkvod.app.utils.ToastUtils;
import com.haochang.chunkvod.app.utils.VodDialog;
import com.haochang.chunkvod.controller.adapter.base.BaseAdapterHelper;
import com.haochang.chunkvod.controller.adapter.base.QuickAdapter;
import com.haochang.chunkvod.model.hostess.HostessInfo;

import android.content.Context;
import android.view.Gravity;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

/**
 * 代付列表adapter
 *     @author Yangjie
 *     className InsteadChargeAdapter
 *     created at  2016/10/20  19:27
 */
public class InsteadChargeAdapter extends QuickAdapter<HostessInfo>
{
	private Context mContext;

	public InsteadChargeAdapter(Context context, int layoutResId, List<HostessInfo> list)
	{
		super(context, layoutResId, list);
		mContext = context;
	}

	@Override
	protected void convert(BaseAdapterHelper helper, HostessInfo item) {

		helper.setText(R.id.tv_time,"我是代付时间" + helper.getPosition());
		helper.setText(R.id.tv_amount,"我是金额" + helper.getPosition());
		helper.setText(R.id.tv_room,"房号" + helper.getPosition());
		helper.getView(R.id.tv_click).setTag(item);
		helper.getView(R.id.tv_click).setOnClickListener(onBaseClickListener);
	}

	OnBaseClickListener onBaseClickListener = new OnBaseClickListener()
	{
		@Override
		public void onBaseClick(View v)
		{//显示弹出框
			HostessInfo item = (HostessInfo) v.getTag();
			if (item != null)
			{
				StringBuilder stringBuilder = new StringBuilder();
				stringBuilder.append("流水号:").append(item.getName()).append("\n");
				stringBuilder.append("预收时间:").append(item.getStatementTime()).append("\n");
				stringBuilder.append("类型:").append(item.getType()).append("\n");
				stringBuilder.append("金额:").append(item.getType()).append("\n");
				stringBuilder.append("备注:").append(item.getType()).append("\n");
				stringBuilder.append("已挂入房间:").append(item.getType()).append("\n");
				new VodDialog.Builder(mContext).autoDismiss(true).dialogEnum(VodDialog.DialogEnum.ONLY_TOAST).autoDismiss(true).contentName(stringBuilder)
						.setContentGravity(Gravity.LEFT).build().showWithWindowParams(0);
			} else
			{
				ToastUtils.showText(mContext, "挂入房间信息获取异常!");
			}
		}
	};

}
